package com.art.wisdom.controller.user;

import org.apache.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.art.wisdom.api.user.IUserService;
import com.art.wisdom.config.AppProperties;
import com.art.wisdom.config.Config;
import com.art.wisdom.config.GlobalProperties;
import com.art.wisdom.config.MyConfig;
import com.art.wisdom.config.Service;
import com.art.wisdom.config.UserInfo;
import com.art.wisdom.model.User;
import com.art.wisdom.util.Result;

//@RestController
@Controller
public class UserController {
	
	 private Logger logger = Logger.getLogger(UserController.class);
	
	 private org.slf4j.Logger loggerr = LoggerFactory.getLogger(UserController.class);
	
	 @Autowired
     private IUserService userService;
	
	 @Autowired
	 private Config config;
	 
	 @Autowired
	 private MyConfig myConfig;
	 
	 @Autowired
	 private Service service;
	 
	 @Autowired
	 private UserInfo userInfo;
	
	 @Autowired
	 private AppProperties app;
	 
	 @Autowired
	 private GlobalProperties global;
	
	
    @RequestMapping("/")
    @ResponseBody
    String home() {
    	
	   String appProperties = app.toString();
       String globalProperties = global.toString();
       
       loggerr.info("id={},name={}",userInfo.getId(),userInfo.getName());
       

        loggerr.info("Welcome {}, {}", app, global);
        
        loggerr.info("Welcome appProperties={}, globalProperties={}", appProperties, globalProperties);
    	
    	
//    	List<String> list = config.getServers();
//    	
//    	for (String s : list) {
//			
//    		logger.info("====" + s );
//		}
    	
    	Result<User>  result = userService.getUserByIdInfo("1");
    	logger.info("===========>>>" + result.getModel().getNickname());
    	//return result.getModel();
        return "Hello World!";
    }
}
